package string;

public class trimDemo {
    //trim()去除当前字符串两边的空白  去除之后得到一个新的字符串
    public static void main(String[] args) {
        String str="     hello    ";
        System.out.println(str.length());
        String str1=str.trim();//1
        System.out.println(str.length());//2
        System.out.println(str1.length());//3
        str=str.trim();//1
        System.out.println(str.length());//2
    }
}
